package com.jdz.service.impl;

import com.google.common.collect.Lists;
import com.jdz.common.ServerResponse;
import com.jdz.dao.ClassNamesMapper;
import com.jdz.dao.ProjectGradeMapper;
import com.jdz.pojo.ProjectGrade;
import com.jdz.service.IProjectDetailsService;
import com.jdz.service.IProjectGradeService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by sun
 **/
@Service("IProjectGradeService")
public class ProjectGradeServiceImpl implements IProjectGradeService {

    @Autowired
    ProjectGradeMapper projectGradeMapper;

    private Logger logger = LoggerFactory.getLogger(ProjectGradeServiceImpl.class);



    @Override
    public ServerResponse list() {

        List<ProjectGrade> projectGradeList = projectGradeMapper.selectList();
        List<String> list = Lists.newArrayList();

        if(CollectionUtils.isEmpty(projectGradeList)){
            logger.info("未找到项目级别");
        }

        for(ProjectGrade projectGrade : projectGradeList){
            list.add(projectGrade.getProjectgradename());
        }

        return ServerResponse.createBySuccess(list);
    }

}
